package com.bjsxt.livegoods.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @ClassName : Item
 * @Description : 商品
 * @Author : ZWZ
 * @Date: 2021/8/23 15:01
 */
@EqualsAndHashCode
@ToString
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class Item implements Serializable {

    private String id;

    /**
     * 标题，字符串
     */
    private String title;
    /**
     * 商品图片，字符串
     */
    private String img;
    /**
     * 跳转链接，字符串
     */
    private String link;
    /**
     * 销量，数学
     */
    private Long sales;
    /**
     * 是否为热门，布尔
     */
    private Boolean recommendation;
    /**
     * 热门排序|权重，数学
     */
    private Byte recoSort;
    /**
     * 所属城市，字符串
     */
    private String city;
    /**
     * 价格，数学
     */
    private Long price;

    /**
     * 租赁方式，整租，合租等。 字符串
     */
    private String rentType;

    /**
     * 房屋面积，字符串
     */
    private String houseType;

    /**
     * 房屋特性， Map 集合。集合存储数据内容为：
     * years: "建造年份",
     * type: "房屋类 型，几室几厅",
     * level: "所在楼层",
     * style: "装修标准",
     * orientation: "房屋朝向"
     */
    private Map<String, String> info;

    /**
     * 图片集合。字符串数组或集合。
     */
    private List<String> imgs;

    /**
     * 购买时间
     */
    private Date buytime;

    /**
     * 是否被出租了
     */
    private Boolean isRented;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getImg() {
        return imgs.get(0);
    }

    public void setImg(String img) {
        // this.img = img;
    }

    public String getLink() {
        return "/details" + id;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public Long getSales() {
        return sales;
    }

    public void setSales(Long sales) {
        this.sales = sales;
    }

    public Boolean getRecommendation() {
        return recommendation;
    }

    public void setRecommendation(Boolean recommendation) {
        this.recommendation = recommendation;
    }

    public Byte getRecoSort() {
        return recoSort;
    }

    public void setRecoSort(Byte recoSort) {
        this.recoSort = recoSort;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public Long getPrice() {
        return price;
    }

    public void setPrice(Long price) {
        this.price = price;
    }

    public String getRentType() {
        return rentType;
    }

    public void setRentType(String rentType) {
        this.rentType = rentType;
    }

    public String getHouseType() {
        return houseType;
    }

    public void setHouseType(String houseType) {
        this.houseType = houseType;
    }

    public Map<String, String> getInfo() {
        return info;
    }

    public void setInfo(Map<String, String> info) {
        this.info = info;
    }

    public List<String> getImgs() {
        return imgs;
    }

    public void setImgs(List<String> imgs) {
        this.imgs = imgs;
    }

    public String getHouseType4Search() {
        // "楼层 | 几室几厅 - 面积"
        return info.get("level") + " | " + info.get("type") + " - " + houseType;
    }

    public Date getBuytime() {
        return buytime;
    }

    public void setBuytime(Date buytime) {
        this.buytime = buytime;
    }

    public Boolean getRented() {
        return isRented;
    }

    public void setRented(Boolean rented) {
        isRented = rented;
    }
}
